import request from '../utils/request';

// 获取首页列表资源
export const getFoodHomeList = () => {
    return request.get('/article/home/list');
};

// 获取文章详情
export const getFoodArticleDetail = (id) => {
    return request.get('/article/get/detail/' + id);
};

// 根据类型获取文章列表
export const getFoodArticleByType = (type) => {
    return request.get('/article/get/type/' + type);
};

// 根据板块获取文章列表
export const getFoodArticleByBankuai = (bankuai) => {
    return request.get('/article/get/bankuai/' + bankuai);
};

// 搜索文章
export const searchFoodArticle = (keyword) => {
    return request.get('/article/get/search/' + keyword);
};

// 添加文章
export const addFoodArticle = (data) => {
    return request.post('/article/add', data);
};

// 收藏文章
export const collectionFoodArticle = (id) => {
    return request.get('/article/collection/' + id);
};

// 获取文章收藏数量
export const getFoodArticleCollectionCount = (id) => {
    return request.get('/article/collection/count/' + id);
};

// 收藏列表
export const getFoodArticleCollectionList = () => {
    return request.get('/article/collection/list');
};

// 删除收藏
export const deleteFoodArticleCollection = (id) => {
    return request.get('/article/collection/delete/' + id);
};

// 按作者查询文章列表
export const getFoodArticleByAuthor = () => {
    return request.get('/article/get/author/list');
};

// 更新文章
export const updateFoodArticle = (data) => {
    return request.put('/article/update', data);
};

// 删除文章
export const deleteFoodArticle = (id) => {
    return request.delete('/article/delete/' + id);
};


